﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using SQLExecute;
//using Pro


/// <summary>
/// Summary description for RecruitmentInformation
/// </summary>
public class Recruitment_Information :Profiles
{
    //private Guid _id;
    DataSet ds;
	public Recruitment_Information()
	{
		
	}
    public Guid ProfileID
    {
        set { _id = value; }
        get { return _id; }
    }
    private string _conclusion_recruitment_information;
    public string ConclusionRecruitmentInformation
    {
        set { _conclusion_recruitment_information = value; }
        get { return _conclusion_recruitment_information; }
    }
    private string _final_position_offer;
    public string PositionOffer
    {
        set { _final_position_offer = value; }
        get { return _final_position_offer; }
    }
    private string _recruitment_dep;
    public string RecruitmentDep
    {
        set { _recruitment_dep = value; }
        get { return _recruitment_dep; }
    }
    int? _recruitment_salary = null;
    public int RecruitmentSalary
    {
        set { _recruitment_salary = value; }
        get { return _recruitment_salary.Value; }
    }
    private string _recruitment_note;
    public string RecruitemtNote
    {
        set { _recruitment_note = value; }
        get { return _recruitment_note; }
    }
    private DateTime _recruitment_starting_date;
    public DateTime RecruitmentStartingDateTime
    {

        set { _recruitment_starting_date = value; }
        get { return _recruitment_starting_date; }
    }
    public string _company_id;
    public string Company
    {
        set { _company_id = value; }
        get { return _company_id; }
    }
    public void Init_Company(DropDownList cb)
    {

        string strSQL = "select * from tbl_company where active='1'";
        ds = SqlHelper.ExecuteDataset(Common.strConnect, CommandType.Text, strSQL);
        cb.DataSource = ds.Tables[0];
        cb.DataTextField = "company_id";
        cb.DataValueField = "company_id";
        cb.DataBind();
        cb.Items.Insert(0, new ListItem("CHOOSE ONE", "CHOOSE ONE"));
        cb.SelectedIndex = 0;

    }
    public int _send_mail;
    public int SendMail
    {
        set { _send_mail=value;}
        get { return _send_mail; }
    }
    //RECRUITMENT INFORMATION
    public void Insert_Recruitment_Information()
    {

        SqlHelper.ExecuteNonQuery(Common.strConnect, "Insert_Recruitment_Information",
                                  new object[] { this._id,this._conclusion_recruitment_information,this._company_id
                                                 ,this._final_position_offer,this._recruitment_dep,this. _recruitment_salary
                                                 ,this._recruitment_starting_date,this._recruitment_note });
    }
    public void Update_Recruitment_Information()
    {

        SqlHelper.ExecuteNonQuery(Common.strConnect, "Update_Recruitment_Information",
                                  new object[] {this._id
                                                ,this._conclusion_recruitment_information
                                                ,this._company_id                                               
                                                ,this._final_position_offer
                                                ,this._recruitment_dep
                                                ,this. _recruitment_salary
                                                ,this._recruitment_starting_date.ToShortDateString()
                                                ,this._recruitment_note
                                                ,this._send_mail});
    }
    public void Update_Send_Mail_Rejected(Guid id)
    {

        string sql = "update tbl_recruitment_information set send_mail='1' where profile_id='" + id + "'";
        SqlHelper.ExecuteNonQuery(Common.strConnect, CommandType.Text, sql);


    }

}
